﻿<UserControl x:Class="ScrumFactory.Login.Login"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:props="clr-namespace:ScrumFactory.Login.Properties"        
             xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers"
             
             mc:Ignorable="d" 
             d:DesignHeight="540" d:DesignWidth="936"
             
                          xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition"                             
        
            x:Name="thisView"

           
            SnapsToDevicePixels="True"
        >
   
    <UserControl.Resources>        
        <DataTemplate x:Key="ProviderTemplate">
            <Button Style="{StaticResource CleanButton}"
                    Width="210" Height="64"
                    Command="{Binding Model.SignInCommand, ElementName=thisView}" CommandParameter="{Binding .}"
                    ToolTip="{Binding ProviderName}"
                    Margin="0,10,10,10">                
                <Border BorderThickness="3" CornerRadius="5" >
                    <Border.Background>
                        <ImageBrush ImageSource="{Binding ProviderImageUrl}" TileMode="None"/>
                    </Border.Background>                    
                    <Border.Style>
                        <Style>
                            <Setter Property="Border.BorderBrush" Value="#DDDDDD"/>
                            <Style.Triggers>
                                <Trigger Property="Border.IsMouseOver" Value="True">
                                    <Setter Property="Border.BorderBrush" Value="{StaticResource LinkBrush}"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Border.Style>
                </Border>
                
            </Button>
                
        </DataTemplate>
    </UserControl.Resources>
    <TabControl Style="{StaticResource WindowTabControl}">
        <TabControl.Items>
            <TabItem Header="{x:Static props:Resources.Sign_in}">
                <SF_Helpers:PanelLayout Title="{x:Static props:Resources.Sign_in}" Style="{StaticResource DetailPanelLayout}">

                    <SF_Helpers:PanelLayout.Content>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>                                
                            </Grid.RowDefinitions>

          
                            <TextBlock Grid.ColumnSpan="2" Grid.Row="0" Style="{StaticResource TitleTextBlock}" Text="{x:Static props:Resources.Sign_in_using}"/>


                            <TextBlock Grid.Column="0" Grid.Row="1" Text="{x:Static props:Resources.at}" Style="{StaticResource LabelTextBlock}" VerticalAlignment="Top" />
                            <StackPanel Grid.Column="1" Grid.Row="1" Orientation="Vertical" >                                
                                <TextBox                                     
                                    Text="{Binding ServerUrl}" Width="660" />
                                <TextBlock  Margin="4,0,0,10" >
                                    <Hyperlink Command="{Binding SetDemoServerCommand}" FontSize="{StaticResource SmallFontSize}">
                                        <Run Text="{x:Static props:Resources.Click_here_to_use_the_demo_server}"/>
                                    </Hyperlink>                                    
                                </TextBlock>
                            </StackPanel>
                            

                            <TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static props:Resources.Authenticate_with}" Style="{StaticResource LabelTextBlock}" VerticalAlignment="Top" />
                            <ItemsControl
                                Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" Margin="4,0,0,0"
                                ItemTemplate="{StaticResource ProviderTemplate}"
                                ItemsSource="{Binding AllProviders}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel Width="670" HorizontalAlignment="Left" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>



                            <TextBlock Grid.Column="1" Grid.Row="3" Margin="4,20,0,0" Foreground="{StaticResource TextBrush}" >
                                <Run Text="{x:Static props:Resources.login_help}"  />                                
                                <Hyperlink Command="{Binding OpenHelpCommand}">
                                    <Run Text="{x:Static props:Resources.Click_here_for_help}"  />                                        
                                </Hyperlink>
                                        
                            </TextBlock>


                        </Grid>
                    </SF_Helpers:PanelLayout.Content>
                </SF_Helpers:PanelLayout>
            </TabItem>
        </TabControl.Items>
    </TabControl>
</UserControl>
